﻿<navigation:PageView x:Class="Corina.Cydee.Apphub.Views.Weburls.PermView"
                     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                     xmlns:behavior="clr-namespace:Corina.Controls.Silverlight.Behaviours;assembly=Corina.Controls.Silverlight"
                     xmlns:controls="clr-namespace:Corina.Controls.Silverlight;assembly=Corina.Controls.Silverlight"
                     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                     xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
                     xmlns:localViewmodel="clr-namespace:Corina.Cydee.Apphub.Viewmodels"
                     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                     xmlns:navigation="clr-namespace:Corina.Cydee.Apphub.Base"
                     xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
                     xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
                     Title="访问权限分配"
                     FontSize="14"
                     d:DesignHeight="480"
                     d:DesignWidth="640"
                     mc:Ignorable="d">
    <navigation:PageView.DataContext>
        <localViewmodel:PermViewmodel />
    </navigation:PageView.DataContext>
    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>

        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <ListBox Background="Transparent"
                     BorderThickness="0"
                     ItemsSource="{Binding AccountTypeCollection}"
                     SelectedItem="{Binding SelectedAccountType,
                                            Mode=TwoWay}">
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <VirtualizingStackPanel Orientation="Horizontal" />
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <ListBox.ItemContainerStyle>
                    <Style TargetType="ListBoxItem">
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="ListBoxItem">
                                    <RadioButton Margin="6"
                                                 Content="{Binding Converter={StaticResource EnumTranslationConverter},
                                                                   ConverterParameter=ACCOUNTTYPE}"
                                                 IsChecked="{Binding IsSelected,
                                                                     Mode=TwoWay,
                                                                     RelativeSource={RelativeSource TemplatedParent}}" />
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </ListBox.ItemContainerStyle>
            </ListBox>

            <ComboBox Grid.Column="1"
                      Width="200"
                      Margin="12,0"
                      HorizontalAlignment="Left"
                      ItemsSource="{Binding RolesCollection}"
                      SelectedItem="{Binding SelectedRole,
                                             Mode=TwoWay}"
                      Visibility="{Binding ShowManagerCollection,
                                           Converter={StaticResource BooleanToVisibilityConverter}}">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <ComboBoxItem Content="{Binding Name}" />
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>

            <ComboBox Grid.Column="1"
                      Width="200"
                      Margin="12,0"
                      HorizontalAlignment="Left"
                      ItemsSource="{Binding LevelCollection}"
                      SelectedItem="{Binding SelectedLevel,
                                             Mode=TwoWay}"
                      Visibility="{Binding ShowManagerCollection,
                                           Converter={StaticResource BooleanToVisibilityInverseConverter}}">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <ComboBoxItem Content="{Binding Title}" />
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
        </Grid>

        <sdk:TabControl Grid.Row="1" Margin="0,12,0,0">
            <sdk:TabItem Header="顶级菜单">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>

                        <ListBox ItemsSource="{Binding UnselectedTopurlCollection}" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
                            <ListBox.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <toolkit:WrapPanel />
                                </ItemsPanelTemplate>
                            </ListBox.ItemsPanel>
                            <ListBox.ItemContainerStyle>
                                <Style TargetType="ListBoxItem">
                                    <Setter Property="Template">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="ListBoxItem">
                                                <Grid Margin="5">
                                                    <VisualStateManager.VisualStateGroups>
                                                        <VisualStateGroup x:Name="CommonStates">
                                                            <VisualState x:Name="Normal" />
                                                            <VisualState x:Name="MouseOver">
                                                                <Storyboard>
                                                                    <DoubleAnimation Duration="0"
                                                                                     Storyboard.TargetName="border"
                                                                                     Storyboard.TargetProperty="(UIElement.Opacity)"
                                                                                     To="1"
                                                                                     d:IsOptimized="True" />
                                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="button" Storyboard.TargetProperty="(UIElement.Visibility)">
                                                                        <DiscreteObjectKeyFrame KeyTime="0">
                                                                            <DiscreteObjectKeyFrame.Value>
                                                                                <Visibility>Visible</Visibility>
                                                                            </DiscreteObjectKeyFrame.Value>
                                                                        </DiscreteObjectKeyFrame>
                                                                    </ObjectAnimationUsingKeyFrames>
                                                                </Storyboard>
                                                            </VisualState>
                                                            <VisualState x:Name="Disabled" />
                                                        </VisualStateGroup>
                                                    </VisualStateManager.VisualStateGroups>
                                                    <Border x:Name="border"
                                                            Background="{StaticResource HighlightLightBrush}"
                                                            CornerRadius="3"
                                                            Opacity="0">
                                                        <Border.Effect>
                                                            <DropShadowEffect ShadowDepth="0" />
                                                        </Border.Effect>
                                                    </Border>
                                                    <Grid Margin="3">
                                                        <Grid.ColumnDefinitions>
                                                            <ColumnDefinition />
                                                            <ColumnDefinition Width="auto" />
                                                        </Grid.ColumnDefinitions>
                                                        <sdk:Label Margin="3,0,0,0"
                                                                   VerticalAlignment="Center"
                                                                   Content="{Binding Title}"
                                                                   FontSize="14" />

                                                        <Button x:Name="button"
                                                                Grid.Column="1"
                                                                Width="12"
                                                                Height="12"
                                                                Margin="3"
                                                                Style="{StaticResource CheckButtonStyle}"
                                                                Visibility="Collapsed">
                                                            <i:Interaction.Triggers>
                                                                <i:EventTrigger EventName="Click">
                                                                    <i:InvokeCommandAction Command="{Binding DataContext.MoveTopurlCommand, RelativeSource={RelativeSource AncestorType=navigation:PageView}}" CommandParameter="{Binding Id}" />
                                                                </i:EventTrigger>
                                                            </i:Interaction.Triggers>
                                                        </Button>
                                                    </Grid>
                                                </Grid>
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </ListBox.ItemContainerStyle>
                        </ListBox>

                        <ListBox Grid.Column="1"
                                 ItemsSource="{Binding AccessTopurlCollection}"
                                 ScrollViewer.HorizontalScrollBarVisibility="Disabled">
                            <ListBox.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <toolkit:WrapPanel />
                                </ItemsPanelTemplate>
                            </ListBox.ItemsPanel>
                            <ListBox.ItemContainerStyle>
                                <Style TargetType="ListBoxItem">
                                    <Setter Property="Template">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="ListBoxItem">
                                                <Grid Margin="5">
                                                    <VisualStateManager.VisualStateGroups>
                                                        <VisualStateGroup x:Name="CommonStates">
                                                            <VisualState x:Name="Normal" />
                                                            <VisualState x:Name="MouseOver">
                                                                <Storyboard>
                                                                    <DoubleAnimation Duration="0"
                                                                                     Storyboard.TargetName="border"
                                                                                     Storyboard.TargetProperty="(UIElement.Opacity)"
                                                                                     To="1"
                                                                                     d:IsOptimized="True" />
                                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="button" Storyboard.TargetProperty="(UIElement.Visibility)">
                                                                        <DiscreteObjectKeyFrame KeyTime="0">
                                                                            <DiscreteObjectKeyFrame.Value>
                                                                                <Visibility>Visible</Visibility>
                                                                            </DiscreteObjectKeyFrame.Value>
                                                                        </DiscreteObjectKeyFrame>
                                                                    </ObjectAnimationUsingKeyFrames>
                                                                </Storyboard>
                                                            </VisualState>
                                                            <VisualState x:Name="Disabled" />
                                                        </VisualStateGroup>
                                                    </VisualStateManager.VisualStateGroups>
                                                    <Border x:Name="border"
                                                            Background="{StaticResource HighlightLightBrush}"
                                                            CornerRadius="3"
                                                            Opacity="0">
                                                        <Border.Effect>
                                                            <DropShadowEffect ShadowDepth="0" />
                                                        </Border.Effect>
                                                    </Border>
                                                    <Grid Margin="3">
                                                        <Grid.ColumnDefinitions>
                                                            <ColumnDefinition />
                                                            <ColumnDefinition Width="auto" />
                                                        </Grid.ColumnDefinitions>
                                                        <sdk:Label Margin="3,0,0,0"
                                                                   VerticalAlignment="Center"
                                                                   Content="{Binding Title}"
                                                                   FontSize="14" />

                                                        <Button x:Name="button"
                                                                Grid.Column="1"
                                                                Width="12"
                                                                Height="12"
                                                                Margin="3"
                                                                Style="{StaticResource CrossButtonStyle}"
                                                                Visibility="Collapsed">
                                                            <i:Interaction.Triggers>
                                                                <i:EventTrigger EventName="Click">
                                                                    <i:InvokeCommandAction Command="{Binding DataContext.MoveTopurlCommand, RelativeSource={RelativeSource AncestorType=navigation:PageView}}" CommandParameter="{Binding Id}" />
                                                                </i:EventTrigger>
                                                            </i:Interaction.Triggers>
                                                        </Button>
                                                    </Grid>
                                                </Grid>
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </ListBox.ItemContainerStyle>
                        </ListBox>
                    </Grid>

                    <StackPanel Grid.Row="1"
                                Margin="0,12,0,0"
                                HorizontalAlignment="Right"
                                Orientation="Horizontal">
                        <Button Width="60"
                                Margin="12,0"
                                Command="{Binding SaveTopurlCommand}"
                                Content="提交" />
                        <Button Width="60"
                                Command="{Binding CancelCommand}"
                                Content="取消" />
                    </StackPanel>
                </Grid>
            </sdk:TabItem>


            <sdk:TabItem Header="子菜单">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>

                        <ListBox ItemsSource="{Binding UnselectedSuburlCollection}" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
                            <ListBox.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <toolkit:WrapPanel />
                                </ItemsPanelTemplate>
                            </ListBox.ItemsPanel>
                            <ListBox.ItemContainerStyle>
                                <Style TargetType="ListBoxItem">
                                    <Setter Property="Template">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="ListBoxItem">
                                                <Grid Margin="5">
                                                    <VisualStateManager.VisualStateGroups>
                                                        <VisualStateGroup x:Name="CommonStates">
                                                            <VisualState x:Name="Normal" />
                                                            <VisualState x:Name="MouseOver">
                                                                <Storyboard>
                                                                    <DoubleAnimation Duration="0"
                                                                                     Storyboard.TargetName="border"
                                                                                     Storyboard.TargetProperty="(UIElement.Opacity)"
                                                                                     To="1"
                                                                                     d:IsOptimized="True" />
                                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="button" Storyboard.TargetProperty="(UIElement.Visibility)">
                                                                        <DiscreteObjectKeyFrame KeyTime="0">
                                                                            <DiscreteObjectKeyFrame.Value>
                                                                                <Visibility>Visible</Visibility>
                                                                            </DiscreteObjectKeyFrame.Value>
                                                                        </DiscreteObjectKeyFrame>
                                                                    </ObjectAnimationUsingKeyFrames>
                                                                </Storyboard>
                                                            </VisualState>
                                                            <VisualState x:Name="Disabled" />
                                                        </VisualStateGroup>
                                                    </VisualStateManager.VisualStateGroups>
                                                    <Border x:Name="border"
                                                            Background="{StaticResource HighlightLightBrush}"
                                                            CornerRadius="3"
                                                            Opacity="0">
                                                        <Border.Effect>
                                                            <DropShadowEffect ShadowDepth="0" />
                                                        </Border.Effect>
                                                    </Border>
                                                    <Grid Margin="3">
                                                        <Grid.ColumnDefinitions>
                                                            <ColumnDefinition />
                                                            <ColumnDefinition Width="auto" />
                                                        </Grid.ColumnDefinitions>
                                                        <sdk:Label Margin="3,0,0,0"
                                                                   VerticalAlignment="Center"
                                                                   Content="{Binding Title}"
                                                                   FontSize="14" />

                                                        <Button x:Name="button"
                                                                Grid.Column="1"
                                                                Width="12"
                                                                Height="12"
                                                                Margin="3"
                                                                Style="{StaticResource CheckButtonStyle}"
                                                                Visibility="Collapsed">
                                                            <i:Interaction.Triggers>
                                                                <i:EventTrigger EventName="Click">
                                                                    <i:InvokeCommandAction Command="{Binding DataContext.MoveSuburlCommand, RelativeSource={RelativeSource AncestorType=navigation:PageView}}" CommandParameter="{Binding Id}" />
                                                                </i:EventTrigger>
                                                            </i:Interaction.Triggers>
                                                        </Button>
                                                    </Grid>
                                                </Grid>
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </ListBox.ItemContainerStyle>
                        </ListBox>

                        <ListBox Grid.Column="1"
                                 ItemsSource="{Binding AccessSuburlCollection}"
                                 ScrollViewer.HorizontalScrollBarVisibility="Disabled">
                            <ListBox.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <toolkit:WrapPanel />
                                </ItemsPanelTemplate>
                            </ListBox.ItemsPanel>
                            <ListBox.ItemContainerStyle>
                                <Style TargetType="ListBoxItem">
                                    <Setter Property="Template">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="ListBoxItem">
                                                <Grid Margin="5">
                                                    <VisualStateManager.VisualStateGroups>
                                                        <VisualStateGroup x:Name="CommonStates">
                                                            <VisualState x:Name="Normal" />
                                                            <VisualState x:Name="MouseOver">
                                                                <Storyboard>
                                                                    <DoubleAnimation Duration="0"
                                                                                     Storyboard.TargetName="border"
                                                                                     Storyboard.TargetProperty="(UIElement.Opacity)"
                                                                                     To="1"
                                                                                     d:IsOptimized="True" />
                                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="button" Storyboard.TargetProperty="(UIElement.Visibility)">
                                                                        <DiscreteObjectKeyFrame KeyTime="0">
                                                                            <DiscreteObjectKeyFrame.Value>
                                                                                <Visibility>Visible</Visibility>
                                                                            </DiscreteObjectKeyFrame.Value>
                                                                        </DiscreteObjectKeyFrame>
                                                                    </ObjectAnimationUsingKeyFrames>
                                                                </Storyboard>
                                                            </VisualState>
                                                            <VisualState x:Name="Disabled" />
                                                        </VisualStateGroup>
                                                    </VisualStateManager.VisualStateGroups>
                                                    <Border x:Name="border"
                                                            Background="{StaticResource HighlightLightBrush}"
                                                            CornerRadius="3"
                                                            Opacity="0">
                                                        <Border.Effect>
                                                            <DropShadowEffect ShadowDepth="0" />
                                                        </Border.Effect>
                                                    </Border>
                                                    <Grid Margin="3">
                                                        <Grid.ColumnDefinitions>
                                                            <ColumnDefinition />
                                                            <ColumnDefinition Width="auto" />
                                                        </Grid.ColumnDefinitions>
                                                        <sdk:Label Margin="3,0,0,0"
                                                                   VerticalAlignment="Center"
                                                                   Content="{Binding Title}"
                                                                   FontSize="14" />

                                                        <Button x:Name="button"
                                                                Grid.Column="1"
                                                                Width="12"
                                                                Height="12"
                                                                Margin="3"
                                                                Style="{StaticResource CrossButtonStyle}"
                                                                Visibility="Collapsed">
                                                            <i:Interaction.Triggers>
                                                                <i:EventTrigger EventName="Click">
                                                                    <i:InvokeCommandAction Command="{Binding DataContext.MoveSuburlCommand, RelativeSource={RelativeSource AncestorType=navigation:PageView}}" CommandParameter="{Binding Id}" />
                                                                </i:EventTrigger>
                                                            </i:Interaction.Triggers>
                                                        </Button>
                                                    </Grid>
                                                </Grid>
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </ListBox.ItemContainerStyle>
                        </ListBox>
                    </Grid>

                    <StackPanel Grid.Row="1"
                                Margin="0,12,0,0"
                                HorizontalAlignment="Right"
                                Orientation="Horizontal">
                        <Button Width="60"
                                Margin="12,0"
                                Command="{Binding SaveSuburlCommand}"
                                Content="提交" />
                        <Button Width="60"
                                Command="{Binding CancelCommand}"
                                Content="取消" />
                    </StackPanel>
                </Grid>
            </sdk:TabItem>
        </sdk:TabControl>
    </Grid>
</navigation:PageView>
